<?php
namespace app\index\controller;
use core\Controller;

class index extends Controller{

    /**
     * http://mf.com/  或者 http://mf.com/index  或者 http://mf.com/index/index  或者 http://mf.com/index/index/index
     */
    public function index()
    {
        // echo sayHello();
         $name=input('name');
//        $word=db('a')->where('id',1)->value('word');
//        dump($word);
        // dump(input('get.'));
//        view_('hello',['name'=>$name,'word'=>$word]);

        $a=['a','b','c','d'];

//        $this->assign(['w'=>$a]);
//        $this->assign(['name'=>'jamy']);
//        $this->fetch('index');

//        $b=db('a')->where('name',input('name'))->find();
//        dump($b);
//        recordLog($b,'log');

//        view('',['name'=>'jamy123','word'=>$word,'w'=>$a]);

        return json(['name'=>'jamy']);
    }


    /**
     * http://mf.com/index/index/throwerror  或者 http://mf.com/index/throwerror
     */
    public function throwerror()
    {
        throw new \Exception('error');
    }


    public function test()
    {
        $this->success('ok',['a'=>1]);
    }


}